'use strict';

module.exports = appInfo => {
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1512368034542_6927';

  // add your config here
  config.middleware = ['checkLogin'];


  config.mongoose = {
    url: 'mongodb://127.0.0.1:54321/SuoHa',
    options: {}
  }
  config.security = {
    csrf: {
      // 判断是否需要 ignore 的方法，请求上下文 context 作为第一个参数
      ignore: ctx => true,
    },
  }
  config.jwt = {
    secret: 'suoha',

    enable: true, // default is false
    match: '/sapi/**', // �optional
  }
  config.checkLogin = {
    enable: true,
    match: '/sapi/**'
  }
  config.io = {
    init: {}, // passed to engine.io
    namespace: {
      '/': {
        connectionMiddleware: [ 'auth' ],
        packetMiddleware: [ 'filter' ],
      },
      '/chat': {
        connectionMiddleware: [ 'auth' ],
        packetMiddleware: ['filter' ],
      },
      '/room':{
        connectionMiddleware: [ 'auth' ],
        packetMiddleware: [],
      }
    }
  };

  return config;
};